# the extensions name, no trailing spaces in the next line
EXTENSION = pggeos
EXTVERSION = $(shell grep default_version $(EXTENSION).control | \
			sed -e "s/default_version[[:space:]]*=[[:space:]]*'\([^']*\)'/\1/")

#DATA = sql/pggeos--0.0.1.sql  # script files to install
#DATA = $(filter-out $(wildcard sql/*--*.sql))
#DOCS = $(wildcard doc/*.md)
REGRESS = pggeos_test     # our test script file (without extension)
#MODULES = pggeos          # our c module file to build
#a shared library to build from multiple source files (list object files in OBJS)
OBJS = dist/pg_geos.o \
       common/pg_io.o

MODULE_big =  pggeos

#an executable program to build (list object files in OBJS)
#PROGRAM = mincost.o main.o my_main

PG_CPPFLAGS =
PG_CXXFLAGS = -std=c++20
SHLIB_LINK = -lgeos_c -L/opt/geos/lib/

# postgres build stuff
PG_CONFIG = pg_config

all: sql/$(EXTENSION)--$(EXTVERSION).sql

sql/$(EXTENSION)--$(EXTVERSION).sql: sql/ext.sql dist/dist.sql
	cat $^ > $@

DATA = $(wildcard updates/*--*.sql) sql/$(EXTENSION)--$(EXTVERSION).sql

EXTRA_CLEAN = sql/$(EXTENSION)--$(EXTVERSION).sql

PGXS := $(shell $(PG_CONFIG) --pgxs)
include $(PGXS)
